package com.shengqiang.cloud.ups.dao.repository.master;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.shengqiang.cloud.ups.dao.modal.UpmsPermission;
import com.shengqiang.cloud.ups.dao.modal.UpmsRole;
import com.shengqiang.cloud.ups.dao.modal.UpmsUser;
import com.shengqiang.cloud.ups.dao.modal.UpmsUserPermission;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/11/15.
 */
public interface UpsUserMapper extends BaseMapper<UpmsUser>{

    @Select("select * from upms_user")
    List<UpmsUser> queryUpsUsers();

    /**
     * 根据用户名查询用户信息
     * @param userName
     * @return
     */
    @Select("select * from upms_user where username=#{userName}")
    UpmsUser queryUserByUserName(String userName);

    /**
     * 分页查询用户列表
     * @param pagination
     * @param condition
     * @return
     */
    List<UpmsUser> selectUpmsUsers(Pagination pagination, Map<String,Object> condition);

    int batchAuditUsers(Map<String,Object> params);

    List<UpmsUser> queryUsersTest(String realname);

    int updateUser(Map<String,Object> params);

    int saveUserRole(Map<String,Object> params);

    int deleteRolesByUserId(int userId);

    List<Map<String,Object>> selectUserRoles(Map<String,Object> params);

    int deleteUserPrivatePermission(Map<String,Object> params);

    int saveUserPrivatePermissions(Map<String,Object> params);

    List<UpmsRole> selectUserRolesByUserId(int userId);

    List<UpmsPermission> selectUserPermissions(int userId);

    List<UpmsPermission> selectUserRolePermissions(int userId);
}

